package com.demo.accessibilitykeeper;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class SecretCodeReceiver extends BroadcastReceiver {
	private static final String TAG = "SecretCodeReceiver";

	@Override
	public void onReceive(Context context, Intent intent) {
		try {
			Intent i = new Intent(context, MainActivity.class);
			i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
			context.startActivity(i);
			Log.i(TAG, "Secret code triggered, launching MainActivity");
		} catch (Throwable t) {
			Log.e(TAG, "Failed to handle secret code", t);
		}
	}
}


